gh-72088: clarify inspect.ismethod and inspect.isfunction (and related) usage with class-level access#150013
Conversation
…l access Accessing a method through the class returns a plain function, not a bound method, so ismethod() returns False in that case. Add a note and a cross-reference to the 'instance methods' section of the data model reference to explain this.
…ass-level access Update inspect docs to note the behavioral differences between inspecting instance methods via the class versus via an instance when checking whether an object is a function or a method.
Documentation build overview
|
Hmm, it is quite new, I'd suggest pinging the original author first, they may have just missed Petr's comment. |
|
They also missed the bot comment; I think stale PRs are fair game. |
Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
Thanks @stefmolin for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @stefmolin for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Sorry, @stefmolin and @encukou, I could not cleanly backport this to |
|
GH-150033 is a backport of this pull request to the 3.14 branch. |
|
Thanks @stefmolin for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
|
GH-150119 is a backport of this pull request to the 3.15 branch. |
Update
inspectmodule docs to note the behavioral differences between inspecting instance methods accessed via the class versus via an instance when checking whether an object is a function or a method.This is a continuation from the abandoned PR #146505. In addition to addressing the comments, I noticed the note wasn't correct in the case of class methods and static methods, so I modified the note to explicitly say it applied to instance methods and added a separate sentence for static methods.